home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / magazi~1 / 207a / learnbas / telephon.bas < prev   
Encoding:
BASIC Source File  |  1988-12-04  |  795 b   |  33 lines

  1. DIM name$(10),number$(10)
  2. PRINT "Enter up to ten names, each followed by a telephone number"
  3. count=1
  4. WHILE count<11
  5.   PRINT  
  6.   INPUT "Enter a name (or f to finish): ",name$(count)
  7.   IF name$(count)<>"f" THEN
  8.     INPUT "Enter a telephone number: ",number$(count)
  9.     count=count+1
  10.   ELSE count=11
  11.   END IF
  12. WEND
  13. lookup$=""
  14. WHILE lookup$<>"f"
  15.   PRINT
  16.   INPUT "Enter a name to search for (or f to finish): ",lookup$
  17.   IF lookup$<>"f" THEN
  18.     found=0
  19.     FOR count=1 TO 10
  20.       IF INSTR(name$(count),lookup$)=1 THEN
  21.         PRINT "The corresponding telephone number is ";number$(count)
  22.         found=1
  23.       END IF
  24.     NEXT count
  25.     IF found=0 THEN 
  26.       PRINT "Sorry, no telephone number found for ";lookup$
  27.     END IF
  28.   END IF
  29. WEND
  30. PRINT
  31. PRINT "End of run"
  32. END
  33.